package com.lmn;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @describe: 定时任务
 */
@Component
public class ScheduleTest {


    @Scheduled(cron = "0 0/5 * * * ?")
    private void configureTasks() {
        System.err.println("执行定时任务时间: " + LocalDateTime.now());
    }

    /**
     * 每隔5秒执行一次
     */
    @Scheduled(fixedRate = 50000)
    public void test1() {
        System.err.println("执行定时任务时间: " + LocalDateTime.now());
    }

}
